import request from '@/utils/request'

// 获取需求列表
export function getDemandList(params) {
  return request({
    url: '/api/demands',
    method: 'get',
    params
  })
}

// 获取需求详情
export function getDemandDetail(id) {
  return request({
    url: `/api/demands/${id}`,
    method: 'get'
  })
}

// 创建需求
export function createDemand(data) {
  return request({
    url: '/api/demands',
    method: 'post',
    data
  })
}

// 更新需求
export function updateDemand(id, data) {
  return request({
    url: `/api/demands/${id}`,
    method: 'put',
    data
  })
}

// 删除需求
export function deleteDemand(id) {
  return request({
    url: `/api/demands/${id}`,
    method: 'delete'
  })
}

// 更新需求状态
export function updateDemandStatus(id, status) {
  return request({
    url: `/api/demands/${id}/status`,
    method: 'patch',
    data: { status }
  })
} 